#ifndef _CCSPINESPRITE_H_
#define _CCSPINESPRITE_H_

#include "cocos2d.h"

NS_CC_BEGIN

#ifndef RENDER_IN_SUBPIXEL
#define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
#endif

class CCSkeletalSprite;

class CCSpineSprite : public CCSprite {
public:
	~CCSpineSprite();
	static CCSpineSprite* create();
	static CCSpineSprite* createWithSpriteFrame(CCSpriteFrame* pSpriteFrame);
    
	virtual void updateTransform();
    
	void setTranformToBatch(const CCAffineTransform& transform);
    
    virtual CCAffineTransform nodeToParentTransform() {
        return m_transformToBatch;
    }
    
    void setPercentage(float p);

    void setColor(const ccColor4B& c4);
    void setFlipX(bool bFlipX);

    void debug();

protected:
	CCSpineSprite();
    
    bool _isFlipX;
    
    /* -------for hp ...unit only----  */
    
    ccTex2F* _orgTextureCoord;
    ccVertex3F* _orgVertex;
    
    float _percentage;
    
    bool _barDirty;
    
private:
    
    ccTex2F textureCoordFromAlphaPoint(CCPoint alpha);
    
    ccVertex3F vertexFromAlphaPoint(CCPoint alpha);
    
    void updateBar();
    
    /* -------for hp ...unit only----  */
    
};

NS_CC_END

#endif